//
// Created by ashCheng on 2023/2/1.
// 1.5.2
#include <iostream>
#include <string>
#include "Sales_data.h"

int main() {
  Sales_data data1, data2;
  double price1, price2;
  std::cin >> data1.bookNo >> data1.units_sold >> price1;
  std::cin >> data2.bookNo >> data2.units_sold >> price2;
  data1.CalcRevenue(price1);
  data2.CalcRevenue(price2);

  if (data1.bookNo == data2.bookNo) {
    data1.AddData(data2);
    data1.Print();
    return 0;
  } else {
    std::cerr << "Data must refer to same ISBN" << std::endl;
    return -1;  // indicate failure
  }
}